Connect to device


In [ ]:
import numpy as np
from teensy_minimal_rpc import SerialProxy
from teensy_minimal_rpc.SIM import R_SCGC6, R_SCGC7
import teensy_minimal_rpc.DMA as dma
from arduino_rpc.protobuf import resolve_field_values

# Disconnect from existing proxy (if available)
try:
    del proxy
except NameError:
    pass

proxy = SerialProxy()

In [ ]:
proxy.echo_array(range(10))

In [ ]:
scgc6 = R_SCGC6.FromString(proxy.read_sim_SCGC6().tostring())
resolve_field_values(scgc6)[['full_name', 'value']].T

In [ ]:
proxy.pin_mode(13, 1)

In [ ]:
proxy.digital_write(13, 1)

In [ ]:
import time

for i in xrange(1000):
    proxy.digital_write(13, 0)
    time.sleep(.005)
    proxy.digital_write(13, 1)
    time.sleep(.001)

In [ ]:
proxy.analog_write(13, 127)